package com.xh.jf_blog.controller.front;

import com.xh.jf_blog.common.util.R;
import com.xh.jf_blog.common.util.SessionInfo;
import com.xh.jf_blog.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author PangJunjie
 * @Date 2024/2/5/005
 */
@Controller("login")
public class LoginController extends SessionInfo {
    @Autowired
    protected TokenService tokenService;


    @GetMapping("/login/info")
    @ResponseBody
    public R info() {
        return R.ok(getVipInfo());
    }

    @GetMapping("/logout")
    @ResponseBody
    public R logout() {
        tokenService.updateTokenByUserinfoId(getVipId());
        return R.ok();
    }

    @GetMapping("/apply")
    public String apply() {
        return "front/article/apply";
    }


}
